
/*-----------------------------------------------------------------------------\
|                          ChipCFlow Block2Code V1.0                           |
|                                                                              |
| Desenvolvedor: Felipe Simões Lage Gomes Duarte                               |
| Orientador: Prof. Dr. Jorge Luiz e Silva                                     |
| Supervisor: Bruno de Abreu Silva                                             |
|	      Joelmir José Lopes                                               |
|                                                                              |
| Main Project: ChipCflow                                                      |
| Período: Agosto de 2009 a Julho de 2010                                      |
| Codigo: Opcoes.java                                                          |
| Versão da IDE: NetBeans IDE 6.8 (Build 200912041610)                         |
| Java: 1.6.0_18; Java HotSpot(TM) Client VM 16.0-b13                          |
| Sistema Operacional: Windows 7 versão 6.1 executando em x86; pt_BR           |
|                                                                              |
|             O presente trabalho foi realizado com apoio do CNPq              |
|   Conselho Nacional de Desenvolvimento Científico  e Tecnológico - Brasil    |
\-----------------------------------------------------------------------------*/
package view;//Nome do pacote de dados.

import java.awt.Toolkit;

public class Opcoes extends javax.swing.JFrame {

  private static Opcoes SINGLETON;
  //Opções do editor
  private boolean Grade; //grade de desenho do canvas
  private int precisao; //precisao

  /** Creates new form Opcoes */
  private Opcoes() {
    initComponents();
    this.setLocation(((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (this.getWidth() / 2)),
            ((Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (this.getHeight() / 2)));
    this.gradeCheckBox.setSelected(true);

    Grade = this.gradeCheckBox.isSelected();
    precisao = (Integer) this.precisaoSpinner.getValue();
  }

  public static Opcoes getInstance() {
    if (SINGLETON == null) {
      SINGLETON = new Opcoes();
    }
    return SINGLETON;
  }

  public boolean isGrade() {
    return Grade;
  }

  public void setGrade(boolean Grade) {
    this.Grade = Grade;
  }

  public int getPrecisao() {
    return precisao;
  }

  public void setPrecisao(int precisao) {
    this.precisao = precisao;
  }

  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    gradeCheckBox = new javax.swing.JCheckBox();
    precisaoSpinner = new javax.swing.JSpinner();
    ColorCB = new javax.swing.JCheckBox();
    CancelarB = new javax.swing.JButton();
    AplicarB = new javax.swing.JButton();
    OkB = new javax.swing.JButton();

    gradeCheckBox.setText("Grade");
    gradeCheckBox.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        gradeCheckBoxActionPerformed(evt);
      }
    });

    precisaoSpinner.setModel(new javax.swing.SpinnerNumberModel(10, 0, 100, 1));

    ColorCB.setText("Operadores Coloridos");

    CancelarB.setText("Cancelar");
    CancelarB.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        CancelarBActionPerformed(evt);
      }
    });

    AplicarB.setText("Aplicar");
    AplicarB.setMaximumSize(new java.awt.Dimension(75, 23));
    AplicarB.setMinimumSize(new java.awt.Dimension(75, 23));
    AplicarB.setPreferredSize(new java.awt.Dimension(75, 23));

    OkB.setText("Ok");
    OkB.setMaximumSize(new java.awt.Dimension(75, 23));
    OkB.setMinimumSize(new java.awt.Dimension(75, 23));
    OkB.setPreferredSize(new java.awt.Dimension(75, 23));
    OkB.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        OkBActionPerformed(evt);
      }
    });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addGap(32, 32, 32)
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(ColorCB)
          .addGroup(layout.createSequentialGroup()
            .addComponent(gradeCheckBox)
            .addGap(136, 136, 136)
            .addComponent(precisaoSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)))
        .addContainerGap(138, Short.MAX_VALUE))
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
        .addContainerGap(160, Short.MAX_VALUE)
        .addComponent(OkB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(AplicarB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(CancelarB)
        .addContainerGap())
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(layout.createSequentialGroup()
            .addGap(38, 38, 38)
            .addComponent(gradeCheckBox)
            .addGap(56, 56, 56)
            .addComponent(ColorCB))
          .addGroup(layout.createSequentialGroup()
            .addGap(57, 57, 57)
            .addComponent(precisaoSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 126, Short.MAX_VALUE)
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
          .addComponent(CancelarB)
          .addComponent(AplicarB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(OkB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        .addContainerGap())
    );

    pack();
  }// </editor-fold>//GEN-END:initComponents

    private void gradeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gradeCheckBoxActionPerformed
      //Block2Code.getSingleton().setGrade(GradeCB.isSelected());
    }//GEN-LAST:event_gradeCheckBoxActionPerformed

    private void CancelarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelarBActionPerformed
      this.setVisible(false);
    }//GEN-LAST:event_CancelarBActionPerformed

    private void OkBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkBActionPerformed
      this.setVisible(false);
    }//GEN-LAST:event_OkBActionPerformed
  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JButton AplicarB;
  private javax.swing.JButton CancelarB;
  private javax.swing.JCheckBox ColorCB;
  private javax.swing.JButton OkB;
  private javax.swing.JCheckBox gradeCheckBox;
  private javax.swing.JSpinner precisaoSpinner;
  // End of variables declaration//GEN-END:variables

  public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {

      public void run() {
        new Opcoes().setVisible(true);
      }
    });
  }
}
